package com.chr.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chr.entity.Address;
import com.chr.repository.AddressRepository;

import java.util.List;


/**
 * Created by tian on 2016/12/1.
 */
@Service
public class AddressService {

	@Autowired
	AddressRepository addressRepository;

	public List<Address> findAll() {
		return addressRepository.findAll();
	}

	public Address findOne(Long id) {
		return addressRepository.findOne(id);
	}

	public Address saveAndFlush(Address address) {
		return addressRepository.saveAndFlush(address);
	}

	public List<Address> saveAddressList(List<Address> addressList) {
		return addressRepository.save(addressList);
	}

	public Address updateAddress(Address address) {
		return addressRepository.saveAndFlush(address);
	}

	public void dateleAddress(Long id) {
		addressRepository.delete(id);
	}
}
